package com.tricode.ile.training.task.one.printarrayinconsole;

import java.util.Scanner;

import com.tricode.ile.training.task.one.helpers.PrintArray;

public class PrintArrayInConsole {

	/**
	 * Prints the elements from array into console
	 * 
	 * @param args
	 */
	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		int[] array = new int[5000];
		int i = 0;
		System.out.println("Enter the elements (enter character if you want to exit):");
		while (scanner.hasNextInt()) {
			array[i] = scanner.nextInt();
			i++;
		}
		scanner.close();
		int[] newArray = new int[i];
		System.arraycopy(array, 0, newArray, 0, i);

		PrintArray printArray = new PrintArray();
		System.out.println("This is the array you entered:");
		printArray.printArrayOfIntegers(newArray);

	}

}
